package com.wangsai.framework.supersecurity.example.cloud.client.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author Mr.Wang
 * @description
 * @date 2021-08-16 15:28
 */
@Api(tags = "RestTemplate测试模块")
@RestController
@RequestMapping("/restTemplate")
public class RestTemplateController {

    @Autowired
    private RestTemplate restTemplate;


    @ApiOperation(value = "获取用户名")
    @GetMapping("/getAccessUsername")
    public String getAccessUsername() {
        ResponseEntity<String> responseEntity = restTemplate.getForEntity("http://super-security-server/restTemplate", String.class);
        return responseEntity.getBody();
    }


}